
const TokenKey = 'leju-admin-token'
const userinfoKey = 'leju-user-info'
export function getToken() {
  return JSON.parse(localStorage.getItem(TokenKey))
}

export function setToken(token) {
  localStorage.setItem(TokenKey, JSON.stringify(token))
}

export function removeToken() {
  return localStorage.removeItem(TokenKey)
}

export function getUserInfo() {
  return JSON.parse(localStorage.getItem(userinfoKey))
}

export function setUserInfo(token) {
  return localStorage.setItem(userinfoKey, JSON.stringify(token))
}

export function removeUserInfo() {
  return localStorage.removeItem(userinfoKey)
}

export function clear() {
  removeToken()
  removeUserInfo()
}
